﻿<table id="listtable"></table>
<div class="buttondiv"></div>
<script type="text/javascript">
    var curPageSize;
    var curPageNumber;
    $(function () {
        $("#listtable").jqGrid({
            url: "QueryRead@(Html.Raw(ViewData["queryString"]))",
            postData: {},
            mtype: 'POST',
            datatype: "json",
            colNames: ['接收人', '所在组织', '是否阅读', '阅读时间'],
            colModel: [
                { name: 'UserId', index: 'UserId', width: 50 },
                { name: 'Organize', index: '', width: 250 },
                { name: 'IsRead', index: 'IsRead', width: 30 },
                { name: 'ReadTime', index: 'ReadTime', width: 90 },
            ],
            sortname: "UserId",
            sortorder: "asc",
            height: '100%',
            width: $(window).width(),
            multiselect: false,
            onSelectRow: function () {

            },
            loadComplete: function () {
                var gridObj = $("#listtable");
                var records = gridObj.getGridParam("userData");
                curPageSize = records.pagesize;
                curPageNumber = records.pagenumber;
                $(".buttondiv").html(RoadUI.Core.getPager1(records.total, records.pagesize, records.pagenumber, "query"));
            }
        });
    });
    $(window).resize(function () {
        $("#listtable").setGridWidth($(window).width());
    });
    function query(size, number) {
        var data = {
            pagesize: size || curPageSize, pagenumber: number || curPageNumber
        };
        $("#listtable").setGridParam({ postData: data }).trigger("reloadGrid");
    }
</script>